i386: simplify pte_read_atomic()
authorKeir Fraser <keir@xen.org>
Fri, 29 Oct 2010 17:43:01 +0000 (18:43 +0100)
committerKeir Fraser <keir@xen.org>
Fri, 29 Oct 2010 17:43:01 +0000 (18:43 +0100)
There's no need for a loop here: if the value to be compared against
and the value to be stored are equal, cmpxchg{,8b} act just like a
load anyway.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/include/asm-x86/x86_32/page.h

index 98c20ef27b220fe2d77083a6e0849d958f3de47b..58419046b80ba2108cc500bb91c0fbb4fa293b84 100644 (file)
@@ -84,11 +84,7 @@ extern unsigned int PAGE_HYPERVISOR_NOCACHE;
 
 #endif
 
-#define pte_read_atomic(ptep) ({                              \
-    intpte_t __pte = *(ptep), __npte;                         \
-    while ( (__npte = cmpxchg(ptep, __pte, __pte)) != __pte ) \
-        __pte = __npte;                                       \
-    __pte; })
+#define pte_read_atomic(ptep) cmpxchg(ptep, 0, 0)
 #define pte_write_atomic(ptep, pte) do {                      \
     intpte_t __pte = *(ptep), __npte;                         \
     while ( (__npte = cmpxchg(ptep, __pte, (pte))) != __pte ) \